﻿using System;
using System.Net;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Expression.Samples.Shaders
{
	internal static class Global
	{
		public static Uri MakePackUri(string relativeFile)
		{
#if SILVERLIGHT
			//string uriString = "pack://application:,,,/" + AssemblyShortName + ";component/" + relativeFile;
			//string uriString = relativeFile;
			string uriString = "/" + AssemblyShortName + ";component/" + relativeFile;
			return new Uri(uriString, UriKind.Relative);
#else
            string uriString = "pack://application:,,,/" + AssemblyShortName + ";component/" + relativeFile;
            return new Uri(uriString);
#endif
		}

		private static string AssemblyShortName
		{
			get
			{
				if (_assemblyShortName == null)
				{
					Assembly a = typeof(Global).Assembly;

					// Pull out the short name.
					_assemblyShortName = a.ToString().Split(',')[0];
				}

				return _assemblyShortName;
			}
		}

		private static string _assemblyShortName;
	}

}
